#include "udpworker.h"
#include <QDateTime>
#include <QDebug>

UdpWorker::UdpWorker(QObject *parent) : QObject(parent) {}

void UdpWorker::onNewData(const QByteArray &data) {
    qint64 start = QDateTime::currentMSecsSinceEpoch();

    qint64 sum = 0;
    for (int i = 0; i < data.size(); ++i) {
        sum += (uchar)data[i];
    }

    qint64 elapsed = QDateTime::currentMSecsSinceEpoch() - start;
    emit dataProcessed(data.size(), elapsed);
}
